# kernel_headers_musl
# Builds from https://github.com/puppylinux-woof-CE/petbuilds


. ../func
. ../build.conf

URL=http://foss.aueb.gr/mirrors/linux/sabotage/tarballs
SRCPKG=kernel-headers
PKG=kernel_headers_musl
VER=3.12.6-5
COMP=tar.xz
DESC="sanitised Linux headers suitable for musl"
DEPS=
CAT=BuildingBlock
BUILD=
CWD=$(pwd)
[ -z "$MWD" ] && MWD=$(dirname $CWD)	
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
[ -f "$DESKTOP" ] || DESKTOP=not
[ -z "$DEPS" ] && DEPS=not	

ARCH=$(uname -m)
case $ARCH in
 *64) 	LIBDIR=$LIBCONF64 ;;
 arm*)	LIBDIR=$LIBCONFarm;;
 *) 	LIBDIR=$LIBCONF32 ;;
esac

build() {
	# since not X compiling forget build triplet
	cd ${SRCPKG}-${VER}
	make ARCH=$ARCH prefix=$PREFIX DESTDIR=$CWD/$PKG-$VER-noarch_${BUILD} install
	[ "$?" -eq 0 ] || exit
	cd -
}
	
package() {
	# add this recipe
	install -d -m 0755 ./$PKG-$VER-noarch_${BUILD}/usr/src/dev
	cat ${PKG}.petbuild > ./$PKG-$VER-noarch_${BUILD}/usr/src/dev/${PKG}-build-recipe
	for p in `ls|grep "\-noarch"|grep -v "files$"` ; do
		case $p in
			*_DEV*) DESC="$PKG development"; DEPS=+${PKG} ;;
			*_DOC*) DESC="$PKG documentation"; DEPS=+${PKG} ;;
			*_NLS*) DESC="$PKG locales"; DEPS=+${PKG} ;;
		esac
		echo "packaging $p"	
		dir2pet -x -s -w="$DESC" -d="$DEPS" -c=$CAT -p=${p} 2>&1 >/dev/null
		rm -r $p
		mv ${p}.pet ../0pets_out
	done
	rm -r ${SRCPKG}-${VER}
	rm *.files 2>/dev/null
	echo "done!"
}

# main
echo ${SRCPKG}-${VER}.${COMP}
retrieve ${SRCPKG}-${VER}.${COMP}
echo $VER
extract ${SRCPKG}-${VER}.${COMP}
build
package	
alert $PKG
